﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Content.Master" Inherits="System.Web.Mvc.ViewPage<MethodWorx.CMS.UI.Models.PageSystemModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            var buttons = new Array();
            buttons.push({ text: "Save", hasText: false, id: "save", icon: "<%=Url.Content("~/images/icons/disk.png")%>" });
            buttons.push({ text: "Refresh", hasText: false, id: "refresh", icon: "<%=Url.Content("~/images/icons/arrow_refresh.png")%>" });
            buttons.push({ text: "Publish", hasText: false, id: "publish", icon: "<%=Url.Content("~/images/icons/asterisk_yellow.png")%>" });

            MethodWorx.CMS.Toolbar.setButtons(buttons, "#toolbar");

            $("#save").click(function () {
                $("#submit").val("save");
                //  .submit here was not working
                $("#do").click();
            });

            $("#publish").click(function () {
                if (confirm("Are you sure you want to publish this page?")) {
                    $("#submit").val("publish");
                    //  .submit here was not working
                    $("#do").click();
                }
            });
        });
    </script>
    <%using(Html.BeginForm()){ %>
        <%=Html.Hidden("submit") %>
        <div class="formItem">
            <label>Page Name:</label>
            <%:Model.Request.Page.Name%>
        </div>
        <div class="formItem">
            <label>Description:</label>
            <%:Model.Request.Description%>
        </div>
        <div class="formItem">
            <label>Date Created:</label>
            <%:Model.Request.DateCreated%>
        </div>
        <div class="formItem">
            <label>Date Published:</label>
            <%:Model.Request.DatePublished.HasValue ?  Model.Request.DatePublished.ToString() : "Not Yet Published"%>
        </div>
        <div class="formItem">
            <label>Status:</label>
            <%:Model.Request.Status%>
        </div>
        <div class="formItem">
            <label>Tags:</label>
            <%=Html.TextAreaFor(m => m.Request.Tags)%>
        </div>
        <input type="submit" id="do" style="display:none"/>
    <%} %>

</asp:Content>
